/* 补充的CSS样式 */

/* 全局滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.05);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb {
    background: rgba(139, 69, 19, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 69, 19, 0.5);
}

/* 背景装饰元素动画 */
@keyframes floatCloud {
    0%, 100% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(10px) translateY(-5px); }
}

@keyframes flutterBird {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(5px) rotate(5deg); }
    50% { transform: translateX(0) rotate(0deg); }
    75% { transform: translateX(-5px) rotate(-5deg); }
}

/* 战斗特效 */
@keyframes hitEffect {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes towerBuildEffect {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes goldCoinEffect {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-20px); opacity: 0; }
}

/* 游戏元素样式增强 */
.tower-select {
    position: relative;
    overflow: hidden;
}

.tower-select::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.tower-select:hover::before {
    left: 100%;
}

/* 升级按钮特殊效果 */
#upgrade-tower {
    position: relative;
    overflow: hidden;
}

#upgrade-tower::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
}

#upgrade-tower:active::after {
    width: 200px;
    height: 200px;
    opacity: 0;
}

/* 地图装饰元素 */
.map-decoration {
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

.map-decoration.tree {
    width: 40px;
    height: 60px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 60'%3E%3Cpath fill='%23166534' d='M20,10 C10,10 5,30 20,50 C35,30 30,10 20,10 Z'/%3E%3Crect fill='%238B4513' x='18' y='40' width='4' height='20'/%3E%3C/svg%3E");
}

.map-decoration.watchtower {
    width: 30px;
    height: 50px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 50'%3E%3Crect fill='%238B4513' x='10' y='10' width='10' height='30'/%3E%3Cpath fill='%23CD853F' d='M5,10 L25,10 L20,0 L10,0 Z'/%3E%3Crect fill='%23D2B48C' x='12' y='15' width='6' height='5'/%3E%3Crect fill='%23D2B48C' x='12' y='25' width='6' height='10'/%3E%3C/svg%3E");
}

/* 战斗提示动画 */
.battle-hint {
    position: absolute;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    animation: goldCoinEffect 1s forwards;
}

.battle-hint.damage {
    color: #dc2626;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.battle-hint.reward {
    color: #d97706;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

/* 波次通知 */
.wave-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 24px;
    font-family: 'Ma Shan Zheng', serif;
    z-index: 100;
    text-align: center;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wave-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.wave-notification::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    padding: 4px;
    background: linear-gradient(45deg, #ef4444, #f59e0b, #3b82f6, #8b5cf6);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

/* 胜利/失败画面 */
.game-result {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.game-result.show {
    opacity: 1;
    pointer-events: all;
}

.game-result .result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.game-result h2 {
    font-family: 'Ma Shan Zheng', serif;
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.game-result p {
    font-size: 18px;
    margin-bottom: 30px;
    max-width: 500px;
    text-align: center;
}

.game-result .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
}

.game-result .stat-item {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.game-result .stat-value {
    font-size: 24px;
    font-weight: bold;
    font-family: 'Ma Shan Zheng', serif;
    color: #f59e0b;
}

.game-result .stat-label {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .game-result h2 {
        font-size: 36px;
    }
    
    .game-result .stats {
        grid-template-columns: 1fr;
    }
    
    .wave-notification {
        font-size: 18px;
        padding: 15px 30px;
    }
    
    #tower-info {
        width: 90%;
        left: 5%;
        transform: none;
        bottom: 20px;
    }
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F5F5DC;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    position: relative;
}

.loading-logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 5px solid rgba(139, 69, 19, 0.1);
    border-top-color: #8B4513;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-family: 'Ma Shan Zheng', serif;
    font-size: 24px;
    color: #8B4513;
    position: relative;
}

.loading-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #8B4513;
    animation: loadingBar 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes loadingBar {
    0%, 100% { width: 0; }
    50% { width: 100%; }
}

/* 教程提示样式 */
.tutorial-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px;
    border-radius: 8px;
    max-width: 250px;
    z-index: 100;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: pulse-slow 3s infinite;
}

.tutorial-tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

.tutorial-tooltip.bottom::after {
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: rgba(0,0,0,0.8);
}

.tutorial-tooltip.top::after {
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: rgba(0,0,0,0.8);
}

.tutorial-tooltip.right::after {
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: rgba(0,0,0,0.8);
}

.tutorial-tooltip.left::after {
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: rgba(0,0,0,0.8);
}

.tutorial-next {
    margin-top: 10px;
    text-align: right;
}

.tutorial-next button {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.tutorial-next button:hover {
    background: #d97706;
}

/* 音效按钮样式 */
.sound-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(139, 69, 19, 0.8);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 50;
    transition: all 0.2s;
}

.sound-control:hover {
    transform: scale(1.1);
    background: #8B4513;
}

/* 暂停菜单样式 */
.pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pause-menu.show {
    opacity: 1;
    pointer-events: all;
}

.pause-content {
    background: #F5F5DC;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 300px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.pause-menu.show .pause-content {
    transform: scale(1);
}

.pause-content h2 {
    font-family: 'Ma Shan Zheng', serif;
    font-size: 28px;
    color: #8B4513;
    margin-bottom: 20px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pause-button {
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: #8B4513;
    color: white;
    font-family: 'Ma Shan Zheng', serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.pause-button:hover {
    background: #6d3610;
    transform: translateY(-2px);
}

.pause-button.resume {
    background: #166534;
}

.pause-button.resume:hover {
    background: #0f4c28;
}

.pause-button.quit {
    background: #dc2626;
}

.pause-button.quit:hover {
    background: #b91c1c;
}